﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IRCServer.Entities.Commands
{
    class SERVERCommand : IRCCommandBase
    {
        public int NodeID { get; set; }

        public string HostName { get; set; }

        public SERVERCommand(string message)
            : base(message)
        {
            string[] parameters = Utilities.CommandParser.GetParameters(message);

            if (parameters.Length > 1)
            {
                this.NodeID = int.Parse(parameters[1]);
            }

            if (parameters.Length > 2)
            {
                this.HostName = parameters[2];
            }

        }

        public override string CommandName()
        {
            return "SERVER";
        }

        public override string ExecuteCommand(SessionBase session)
        {
            CommandHandlers.SERVERCommandHandler handler = new global::IRCServer.CommandHandlers.SERVERCommandHandler();
            return handler.HandleCommand(this, session);
        }
    }
}
